<?php
/*type=Service*/

	class Modules_Projects_Model_CreateProject
	{
		public $result=array("error"=>"","result"=>0);
		public function Modules_Projects_Model_CreateProject($args=null)
		{
			try{
			if($args==null)
				return;
			
				$data=array(
				"workspace_id"=>$_SESSION["workspace"],
				"name"=>$args["projectName"],
				"Begin"=>time()
				);
				$id=BaseObject::AddRecords($data, Modules_Common_DB_Projects:: GetTableName());
				$data=array(
				"id_user"=>$_SESSION['id'],
				"id_projects"=>$id);
				BaseObject::AddRecords($data, Modules_Common_DB_RTUserProject:: GetTableName());
				$this->result["result"]=1;
			}
			catch(Exception $e)
			{
				$this->result["result"]=0;
				$this->result["error"]="Success Creating new Project";
			}
		}
		public function Init()
		{
			
		}
	}
?>